//
//  Rank_PeopleInfoPhotoCell.m
//  YLProject
//
//  Created by 张伯林 on 2018/2/3.
//  Copyright © 2018年 WY. All rights reserved.
//

#import "Rank_PeopleInfoPhotoCell.h"
#import "Rank_PeopleInfoPhotoCollCell.h"
@implementation Rank_PeopleInfoPhotoCell

- (void)awakeFromNib {
    [super awakeFromNib];
//    [_collectionView registerClass:UICollectionViewCell.class  forCellWithReuseIdentifier:NSStringFromClass(UICollectionViewCell.class)];
    [_collectionView registerNib:[UINib nibWithNibName:NSStringFromClass(Rank_PeopleInfoPhotoCollCell.class) bundle:nil] forCellWithReuseIdentifier:NSStringFromClass(Rank_PeopleInfoPhotoCollCell.class)];
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]init];
    [tap addTarget:self action:[self selectorBlock:^(id weak, id arg) {
        if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectList:)]) {
            [self.delegate didSelectList:self.type];
        }
    }]];
    [self.backView addGestureRecognizer:tap];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 8;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    Rank_PeopleInfoPhotoCollCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass(Rank_PeopleInfoPhotoCollCell.class) forIndexPath:indexPath];
    cell.backgroundColor = [UIColor purpleColor];
    [cell initWithModel:nil type:self.type];
    return cell;
}
// 选中某item
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(disSelectDetail:index:)]) {
        [self.delegate disSelectDetail:self.type index:indexPath.row];
    }
}
-(void)initWithModel:(id)model index:(NSInteger)index{
    self.type = index;
    switch (index) {
        case Rank_PeopleInfoPhotoBeat:
        {
            self.headerTitleLabel.text = @"随拍";
        }
            break;
        case Rank_PeopleInfoPhotoGift:
        {
            self.headerTitleLabel.text = @"收到礼物";
        }
            break;
        case Rank_PeopleInfoPhotoVideo:
        {
            self.headerTitleLabel.text = @"视频";
        }
            break;
        case Rank_PeopleInfoPhotoPrivate:
        {
            self.headerTitleLabel.text = @"私照";
        }
            break;
        default:
            break;
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
